﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using DbSharp.Utils.IO;
using System.IO;
using DbSharp.Utils;
using DbSharp.Framework.ReleaseManage;
using DbSharp.Framework;

namespace DbSharp.GuiRunner.UI
{
    partial class FormAboutBox : Form
    {
        public FormAboutBox()
        {
            InitializeComponent();
        }


        private void FormAboutBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (Convert.ToByte(e.KeyChar) == (byte)Keys.Escape)
            {
                e.Handled = true;
                this.Close();
            }
        }


        private void LoadAssemblyInfo()
        {
            var assemblyInfoAccessor = new AssemblyInfoAccessor();
            this.Text = String.Format("About {0}", assemblyInfoAccessor.AssemblyProduct);
            this.labelProductName.Text = assemblyInfoAccessor.AssemblyProduct;
            this.labelVersion.Text = String.Format("Version {0}", assemblyInfoAccessor.AssemblyVersion);
            this.labelCopyright.Text = assemblyInfoAccessor.AssemblyCopyright;
            this.labelCompany.Text = assemblyInfoAccessor.AssemblyCompany;
        }


        private void LoadEditionComparisonWebPage()
        {
            string basePath = PathHelper.GetAppPath();
            string htmlPage = "EditionComparison.html";
            htmlPage = Path.Combine(basePath, htmlPage);
            //webBrowser1.Navigate(htmlPage);
        }

        private void FormAboutBox_Load(object sender, EventArgs e)
        {
            LoadAssemblyInfo();
            //LoadEditionComparisonWebPage();

            linkLabelWebsite.Text = VendorInfo.OfficialWebsite;
            linkLabelDevMail.Text = VendorInfo.ChiefDeveloperMail;
            richTextBoxFeatures.Rtf = LoadFeatures();
            labelEdition.Text = EditionPresentOption.GetEditionName();
        }



        private void linkLabelWebsite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ProcessLauncher.CallWindowsApp(linkLabelWebsite.Text, false);
        }

    


        private string LoadFeatures()
        {
            return @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\froman\fprq2\fcharset0 Times New Roman;}}
{\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\nowidctlpar\sb100\sa100\f0\fs22 This product is the first automated DB unit testing tool available using XML as test case. It is just designed for \b\i DBA/DB developers\b0\i0  and be of low learning curve. It also can be used to validate replication, ETL for possible discrepancies.\f1\par
\b\f0\fs24 Feature list,\f1\fs28\par
\pard\nowidctlpar\fi-360\li720\sl360\slmult1\b0\f0\fs22 1.\tab Writing test case with XML, not Java/C++/C#/VB code. \par
2.\tab Supports all popular databases, such as Oracle/SQL Server/My SQL.\par
3.\tab So many kinds of standard assertion supported, such as StrictEqual, SetEqual, IsSupersetOf, Overlaps, and RecordCountEqual etc. \par
4.\tab Allows using an Excel spreadsheet/XML as the source of the data for the tests. \f1\par
\f0 5.\tab Supports sandbox test model, as known as auto rollback.  \par
6.\tab Allows to performing setup/teardown from one DB/Excel into target database.\par
7.\tab Unique cross-different-type-database testing\f1 .\f0  \par
8.\tab Set style comparison for recordset. \par
9.\tab Sequential style comparison for recordset or scalar values. \par
10.\tab Allow to export result set of SQL statement into XML/Excel file. \f1\par
}";
        }


        
  

      
    }
}
